
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <meta http-equiv="Content-Type" content="text/html"; charset="utf-8" />
    <title></title>
    <link href="js/bstable/css/bootstrap.min.css" rel="stylesheet" type="text/css">
    <link href="js/bstable/css/bootstrap-table.css" rel="stylesheet" type="text/css">
    <link href="css/table.css" rel="stylesheet" type="text/css">

    <script src="/js/vue.js"></script>
    <script src="/js/axios.min.js"></script>
</head>
<body style="background-color: #ecf0f5;font-family: 微软雅黑;color: #475059;min-width: 1000px;overflow: auto">
<div id="app">
<div class="notice_main">
    <div class="notice_check">


        <div class="notice_nav r_right">
            <a class="btn btn-default"><span class="glyphicon glyphicon-remove"></span>删除</a>
            <a class="btn btn-default" onclick="addRole()"><span class="glyphicon glyphicon-pencil"></span>修改</a>
        </div>

    <br><br>
    <br>
    <table class="table table-bordered  table-hover">
        <tr>
        <th type="radio">选择</th>
    <th>编号</th>
    <th>评论内容</th>
    <th>发布者</th>
    <th>状态</th>
    <th>发布时间</th>
    <th>理由</th>
    <th>操作</th>
    </tr>
    <tr v-for="(item,index) in pageInfo.list">
        <td><label>
        <input type="checkbox"   id="inlinecheckbox1" value="true">
        </label></td>
    <td> {{index+1}} </td>
    <td>{{item.response_text}}</td>
    <td>{{item.applicant_name}}</td>
    <td>{{item.state}}</td>
    <td>{{item.posttime}}</td>
    <td>{{item.reasonts}}</td>
    <td> <a   @click="delRes(item.response_id)">删除</a> </td>
<!--    <td> <a   @click="updateRes1(item.response_id)">通过</a> |  <a   @click="updateRes(item.response_id)">驳回</a></td>-->
    </tr>
    </table>
        <nav aria-label="Page navigation">
            <ul class="pagination">
                <li>
                <li @click="getPreviousPageData(pageInfo.pageNum)">
                <a href="#" aria-label="Previous">
                    <span aria-hidden="true">&laquo;</span>
                </a>
                </li>
                <li :class="pageInfo.pageNum==num?'active':''" @click="getPageData(num)" v-for="num in pageInfo.navigatepageNums">
                    <a>{{num}}</a></li>
                <li>
                <li @click="getNextPageData(pageInfo.pageNum)">
                <a href="#" aria-label="Next">
                    <span aria-hidden="true">&raquo;</span>
                </a>
                </li>
            </ul>
        </nav>
    </div></div>
</body>
</html>

<script src="js/jquery/jQuery-2.2.0.min.js"></script>
<script src="js/bstable/js/bootstrap.min.js"></script>
<script src="js/bstable/js/bootstrap-table.js"></script>
<script src="js/bstable/js/bootstrap-table-zh-CN.min.js"></script>
<script src="js/layer_v2.1/layer/layer.js"></script>
<script>
    new Vue({
        el:"#app",
        data:{
            applicant_id:0,
            applicantinfo:[],
            pageInfo:[]
        },
        methods:{
            delRes: function (response_id){
                alert("评论"+response_id+"已删除")
                window.localStorage.setItem("sid", response_id);
                location.href="responses.html"
                axios.get('/res/del',{
                    params:{
                        response_id: response_id
                    }
                }).then(function (response){
                    console.log(response.data);
                })
                    .catch(function (error){
                        console.log(error);
                    });
            },
            updateRes:function (response_id){
                alert(response_id)
                window.localStorage.setItem("sid", response_id);
                location.href="responses.html"
                axios.get('/res/update',{
                    params:{
                        response_id:response_id,
                        applicant_id:this.applicant_id,
                    }
                }).then(function (response){
                    console.log(response.data);
                })
                    .catch(function(error){
                        console.log(error)
                    });

            },
            updateRes1:function (response_id) {
                alert(response_id)
                window.localStorage.setItem("sid", response_id);
                location.href = "responses.html"
                axios.get('/res/update1', {
                    params: {
                        response_id: response_id,
                        applicant_id:this.applicant_id
                    }
                }).then(function (response) {
                    console.log(response.data);
                })
                    .catch(function (error) {
                        console.log(error)
                    });
            },
            getPreviousPageData:function(num){
                num--;
                if(num<1){
                    return;
                }
                this.getPageData(num)
            },
            getNextPageData:function(num){
                num++;
                if(num>this.pageInfo.pages){
                    return;
                }
                this.getPageData(num)
            },
            getPageData:function(num){
                _this = this
                axios.get('/res/list/'+num,{
                    params: {
                        response_id:this.response_id,
                        applicant_id:this.applicant_id

                    }
                }).then(function (response){
                    console.log(response.data);
                    _this.pageInfo=response.data.object;

                })
                    .catch(function (error){
                        console.log(error);
                    });
            }
        },
        mounted() {
            this.getPageData(1)

            axios.get('/res/list',{
                params: {
                    response_id:this.response_id,
                    applicant_id:this.applicant_id
                }
            })
                .then(function (response){
                    console.log(response.data);
                    _this.pageInfo=response.data;

                })
                .catch(function (error){
                    console.log(error);
                });
        axios.get('/res/update1', {
            params: {
                response_id: response_id,
                applicant_id:this.applicant_id
            }
        }).then(function (response) {
            console.log(response.data);
        })
            .catch(function (error) {
                console.log(error)
            });


        }
    })

</script>
